﻿<UserControl x:Class="ClassicJukebox.View.MediaView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:WPFMitsuControls;assembly=WPFMitsuControls"
    Loaded="MediaView_Loaded">
    <UserControl.Resources>
        <DataTemplate x:Key="BookPageStyle">
            <Border x:Name="bdr" BorderThickness="1" BorderBrush="Black" Margin="5" Padding="5" Background="Azure">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Image Width="30" Height="30" Source="{Binding Cover}" />
                        <StackPanel Margin="2.5,0,0,0">
                            <TextBlock Text="{Binding Name}" FontSize="14" FontWeight="Bold" TextTrimming="CharacterEllipsis" />
                            <TextBlock Text="{Binding Artist}" />
                        </StackPanel>
                    </StackPanel>

                    <ListBox ItemsSource="{Binding Tracks}" Margin="5,10,0,0" BorderThickness="0" SelectedIndex="0" IsSynchronizedWithCurrentItem="True" Background="{x:Null}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Title}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </Border>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding IsSelected}" Value="False">
                    <Setter TargetName="bdr" Property="Background" Value="#D4D0C8"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </UserControl.Resources>
        <Viewbox>
        <controls:Book x:Name="myBook" ItemsSource="{Binding Albums}" ItemTemplate="{DynamicResource BookPageStyle}" />
    </Viewbox>
</UserControl>
